package threads;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;

import tasks.TaskList;

public class TaskRemover extends Thread {

	private ConcurrentLinkedQueue<TaskList> syncs;
	private String game;

	public TaskRemover(ConcurrentLinkedQueue<TaskList> syncs, String game){
		this.syncs = syncs;
		this.game = game;
	}

	@Override
	public void run() {
		Iterator<TaskList> it = syncs.iterator();
		while(it.hasNext()){
			TaskList list = it.next();
			if(list!=null&&list.getGame().equals(game)){
				syncs.remove(list);
				break;
			}
		}
	}
}
